package com.fsquare.component;

import java.util.Currency;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.StringEscapeUtils;
import org.springframework.stereotype.Component;

@Component
public class CurrencySymbolsWrapper {
	private Map<String, String> currencySymbolsMap;
	
	private Map<String, String> translatedCurrencySymbolsMap = new HashMap<String, String>();
	
	
	public String getCurrencySymbol(Currency currency){
		//currency.getSymbol()
		return getCurrencySymbol(currency.getCurrencyCode());
	}
	
	public String getCurrencySymbol(String currencyCode){
		String result = currencyCode;
		if(currencySymbolsMap != null){
			String symbol = currencySymbolsMap.get(currencyCode);
			if(symbol != null){
				result = StringEscapeUtils.unescapeJava(symbol);
			}
		}
		return result;
	}
	
	/**
	 * @return the currencySymbolsMap
	 */
	public Map<String, String> getCurrencySymbolsMap() {
		return currencySymbolsMap;
	}

	/**
	 * @param currencySymbolsMap the currencySymbolsMap to set
	 */
	public void setCurrencySymbolsMap(Map<String, String> currencySymbolsMap) {
		this.currencySymbolsMap = currencySymbolsMap;
	}
}
